import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';


class ProductPriceWidget extends StatefulWidget{
  final double price;
  final Color textColors;
  final double prefixSize;
  final TextDecoration? textDecoration;
  final double textFontSize;
  final FontWeight fontWeight;
  final MainAxisAlignment mainAxisAlignment;

  const ProductPriceWidget(
      this.price,
      {Key? key,
        this.textDecoration,
        this.textColors=Colors.redAccent,
        this.fontWeight=FontWeight.bold,
        this.textFontSize=18,
        this.prefixSize=12,
        this.mainAxisAlignment=MainAxisAlignment.start}):super(key: key);

  @override
  State<StatefulWidget> createState()=>_ProductPriceWidgetState();

}

class _ProductPriceWidgetState extends State<ProductPriceWidget>{
  @override
  Widget build(BuildContext context) {
    return  Container(
      decoration: const BoxDecoration(

          // image: DecorationImage(
          //     image: AssetImage("assets/images/woman.png"),
          //     fit: BoxFit.fill
          // )
      ),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.end,
        mainAxisAlignment: widget.mainAxisAlignment,
        children: [
          Text("¥",style: TextStyle(
              color: widget.textColors,
              fontSize: widget.prefixSize,
              fontWeight: widget.fontWeight,
              decorationColor: widget.textColors,
              decoration: widget.textDecoration)),
          Text(
              NumberFormat("0.00").format(widget.price),
              style: TextStyle(
                  color: widget.textColors,
                  fontSize: widget.textFontSize,
                  fontWeight: widget.fontWeight,
                  decorationColor: widget.textColors,
                  decoration: widget.textDecoration
              )
          ),

        ],
      ),
    );
  }
}


